import 'dart:math';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

/// A text field that also has buttons to select all the text and copy the
/// selected text to the clipboard.
class BoxShadowPage extends StatefulWidget {
  const BoxShadowPage({super.key});

  @override
  State<BoxShadowPage> createState() => _BoxShadowPageState();
}

class _BoxShadowPageState extends State<BoxShadowPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xFFF5F5F5),
      body: SizedBox.expand(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              height: 400,
              width: 300,
              decoration: const BoxDecoration(
                  //重点就是这两个方向的阴影
                  boxShadow: [
                    BoxShadow(
                        color: Colors.black12,
                        offset: Offset(3.0, 3.0), //阴影xy轴偏移量
                        blurRadius: 5.0, //阴影模糊程度
                        spreadRadius: 3 //阴影扩散程度
                        ), //扩散程度和偏移成都数值要一样
                    BoxShadow(
                        color: Colors.white,
                        offset: Offset(-3.0, -3.0),
                        blurRadius: 4.0,
                        spreadRadius: 3.0)
                  ]),
              child: MaterialButton(
                  //可以不用按钮，用其他widget也行
                  highlightColor: Colors.white,
                  shape: RoundedRectangleBorder(
                    side: BorderSide(color: Color(0xFFF5F5F5)),
                    borderRadius: BorderRadius.circular(6.0),
                  ),
                  color: Color(0xFFF5F5F5),
                  elevation: 0,
                  //关闭按钮自身阴影，采用Container定义的阴影
                  onPressed: () {},
                  child: Column(
                    mainAxisSize: MainAxisSize.min,
                    children: <Widget>[
                      Image.asset("assets/images/banner3.png"),
                      const SizedBox(height: 22),
                      const Text(
                        '程序员应该知其然而知其所以然',
                        style: TextStyle(fontSize: 14),
                      )
                    ],
                  )),
            )
          ],
        ),
      ),
    );
  }
}

void main() => runApp(const MaterialApp(home: BoxShadowPage()));
